package icu.which.strongchild.service;

import icu.which.strongchild.model.domain.User;
import com.baomidou.mybatisplus.extension.service.IService;
import icu.which.strongchild.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author which
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2023-03-01 00:12:41
*/
public interface UserService extends IService<User> {

    /**
     * 是否为管理员
     * @param user
     * @return
     */
    boolean isAdmin(User user);
    boolean isAdmin(UserVO user);
    boolean isAdmin(HttpServletRequest request);

    /**
     * 登录
     *
     * @param userAccount 账号
     * @param password 明文密码
     * @return 是否成功
     */
    UserVO userLogin(String userAccount,String password,HttpServletRequest request);

    /**
     * 退出登录
     *
     * @param httpServletRequest
     * @return
     */
    boolean logout(HttpServletRequest httpServletRequest);

    /**
     * 当前在线用户
     *
     * @param httpServletRequest session
     * @return 当前在线用户
     */
    UserVO getLoginUser(HttpServletRequest httpServletRequest);

    /**
     * 用户注册
     *
     * @param userAccount 账号
     * @param password 密码明文
     * @return 是否成功
     */
    boolean register(String userAccount,String password);

    /**
     * 管理员删除用户或销号
     *
     * @param id
     * @return
     */
    boolean deleteUser(Long id,HttpServletRequest request);

    /**
     * 更新用户信息
     *
     * @param user 用户
     * @return 是否成功
     */
    boolean updateUser(User user,HttpServletRequest request);

    /**
     * 根据信息搜索用户
     * @return
     */
    List<UserVO> searchUsersByTags(List<String> tagNameList);

    /**
     * 匹配用户
     * @param num
     * @param loginUser
     * @return
     */
    List<UserVO> recommondUserByTags(long num, HttpServletRequest request);
}
